<html>
<head>
<h1>Edit Selected Transaction</h1>
</head>
<body>
<?php
	require "configcmd.php";	
	$TransactionID = $_POST['TransactionID'];
	$con = mysql_connect("localhost",$db_user ,$db_pass);

	if (!$con){
		die('Could not connect: ' . mysql_error());
    }
	mysql_select_db($db_name, $con);

	$sql_transactions = "Select * from transactions where TransactionID = ".$TransactionID.";";

	$result = mysql_query($sql_transactions);
	echo "Numbers changed within this transaction will not be reflected within individual accounts.<br/> Account with changed transaction charges will need to be updated to reflect new numbers for transactions.<br/><br/>";
	
	while($row = mysql_fetch_array($result))
	{
		echo "<form action='edittransactionresult.php' method='GET'>";
		echo "Edit transaction with Transaction ID = ".$row['TransactionID']."<br/>";
		echo "<input type='hidden' name = 'TransactionID' value='".$row['TransactionID']."'/> ";

		echo "Charge: <input type='text' name = 'Charge' value='".$row['Charge']."'/> <br/>";
		echo "Date of Charge: <input type='date' name = 'Date_Charge' value='".$row['Date_Charge']."'/> <br/>";
		echo "Description: <input type='text' name = 'Description' value='".$row['Description']."'/> <br/>";


		echo "<input type='submit' name = 'create' value='Edit'/>";
		echo "</form>";
	}
	mysql_close($con);
?>
</body>
<br />
<a href="main.php">Home</a>
<a href="showtransactions.php">View Transactions</a>
</html>